#!/bin/sh

DIR=`pwd`
TOOLDIR="$(dirname "$0")"
QMAKE=$1

cd $TOOLDIR
$QMAKE SetupUi.pro
make

cd ./pack
make clean
make
cp SetupUi ../tool/

cd ../

cp SetupUi ./tool/UiComp

LDD=`ldd SetupUi | grep ld | awk -F ' ' '{print $1}'`
cp $LDD ./tool/lib/ld.so.1

files=$(ldd SetupUi | awk '{if (match($3, "/")){printf("%s "), $3}}')
cp $files ./tool/lib/

cp -r ./tool/* ../build-tools/$(uname -m)/SetupUi/

cd $DIR